package com.fira.edu.service.impl;

import java.util.List;

import com.fira.common.constant.Constants;
import com.fira.common.utils.DateUtils;
import com.fira.common.utils.bean.DozerUtils;
import com.fira.common.utils.uuid.IdUtils;
import com.fira.edu.domain.dto.EduClassroomDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fira.edu.mapper.EduClassroomMapper;
import com.fira.edu.domain.EduClassroom;
import com.fira.edu.service.IEduClassroomService;
import com.fira.common.core.text.Convert;

/**
 * 教室信息Service业务层处理
 * 
 * @author zhushuyong
 * @date 2021-09-29
 */
@Service
public class EduClassroomServiceImpl implements IEduClassroomService 
{
    @Autowired
    private EduClassroomMapper eduClassroomMapper;

    /**
     * 查询教室信息
     * 
     * @param id 教室信息ID
     * @return 教室信息
     */
    @Override
    public EduClassroom selectEduClassroomById(String id)
    {
        return eduClassroomMapper.selectEduClassroomById(id);
    }

    /**
     * 查询教室信息列表
     * 
     * @param eduClassroom 教室信息
     * @return 教室信息
     */
    @Override
    public List<EduClassroom> selectEduClassroomList(EduClassroom eduClassroom)
    {
        return eduClassroomMapper.selectEduClassroomList(eduClassroom);
    }

    /**
     * 新增教室信息
     * 
     * @param classroomDTO 教室信息
     * @return 结果
     */
    @Override
    public int insertEduClassroom(EduClassroomDTO classroomDTO)
    {
        classroomDTO.setId(IdUtils.fastSimpleUUID());
        EduClassroom classroom = DozerUtils.copyProperties(classroomDTO,EduClassroom.class);
        classroom.setStatus(Constants.STATUS_ONE);
        classroom.setCreateTime(DateUtils.getNowDate());
        return eduClassroomMapper.insertEduClassroom(classroom);
    }

    /**
     * 修改教室信息
     * 
     * @param eduClassroom 教室信息
     * @return 结果
     */
    @Override
    public int updateEduClassroom(EduClassroom eduClassroom)
    {
        eduClassroom.setUpdateTime(DateUtils.getNowDate());
        return eduClassroomMapper.updateEduClassroom(eduClassroom);
    }

    /**
     * 删除教室信息对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteEduClassroomByIds(String ids)
    {
        return eduClassroomMapper.deleteEduClassroomByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除教室信息信息
     * 
     * @param id 教室信息ID
     * @return 结果
     */
    @Override
    public int deleteEduClassroomById(String id)
    {
        return eduClassroomMapper.deleteEduClassroomById(id);
    }
}
